﻿using DotNetExtensions.AspNet.SQLites.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace Habi.Solver.Models
{
    [SQLiteTable(Name = "Resources")]
    public class ResourceModel : MetaModel
    {
        public ResourceType Type { get; set; }
        public string Url { get; set; }
        
        public int Status { get; set; } = (int)ResourceStatus.Created;
    }
    
    public class MetaModel : BaseModel
    {
        public string Extension { get; set; }
        public long Size { get; set; }
        public string AboutUrl { get; set; }
        
        [DisplayFormat(DataFormatString = "yy/MM/dd HH:mm")]
        public DateTime? PublishTime { get; set; }
        public string PublishUser { get; set; }
        public string Description { get; set; }
        public int Downloads { get; set; }
        public string Name { get; set; }
        [Display(AutoGenerateField = false)]
        public bool AutoDownload { get; set; }

        public long CreateUserId { get; set; }

        [SQLiteColumn(Ignore = true)]
        [Display(AutoGenerateField = false)]
        public UserModel Operator { get; set; }
    }
    

    public enum ResourceType
    {
        Music = 1,
        Movice = 2,
        Picture = 3,
        Application = 4
    }

    public enum ResourceStatus
    {
        Created = 0,
        Uploaded = 1,
        Pubilshed = 2,
        Downloaded = 3,
        Deleted = 4,
        Uploading = 5,
        Downloading = 6
    }
}
